package com.example.demo;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class DemoApplication {


    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
    @Bean
    public CommandLineRunner BeanRunner(ApplicationContext tx){
        return args -> {
            System.out.println("所有的Bean:");
            String[] strings=tx.getBeanDefinitionNames();
            for(String s:strings)
                System.out.println(s);
        };
    }
}
